using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MongoDB.Bson;
using Colorful.Database;
using Colorful.Apps.Models;

namespace Colorful.Apps
{
    #region DbContext
    public partial class DbContext : Colorful.CMS.Core.DbContext
    {
        private IMongoDatabase _db;

        #region 初始化
        public DbContext(string server, string username, string password, string dbName)
            : base(server, username, password, dbName)
        {
            _db = this.Database;
        }
        public DbContext(string connStr, string dbName)
            :base(connStr, dbName, "App")
        {
            _db = this.Database;
        }
        #endregion

        #region Collections
        /// <summary>
        /// 会员表
        /// </summary>
        public IMongoCollection<Member> Members
        {
            get
            {
                return base.GetCollection<Member>("Members");
            }
        }
        /// <summary>
        /// 应用列表
        /// </summary>
        public IMongoCollection<App> Apps
        {
            get
            {
                return base.GetCollection<App>("Apps");
            }
        }
        #endregion
    }
    #endregion
}
